package org.f0rb.demo.model.role_privilege;

import org.f0rb.core.web.WebModel;

import java.io.Serializable;

/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 11-10-7
 * Time: 下午3:30
 * To change this template use File | Settings | File Templates.
 */
public class RolePrivilege extends WebModel<RolePrivilege> implements Serializable {
    public Integer roleid;
    public Integer privilegeid;

    @Override
    public String model() {
        return "RolePrivilege";
    }

    @Override
    public void fillByModel(RolePrivilege rolePrivilege) {
        roleid = rolePrivilege.roleid;
        privilegeid = rolePrivilege.privilegeid;
    }

    @Override
    public RolePrivilege fillInModel(RolePrivilege rolePrivilege) {
        rolePrivilege.roleid = roleid;
        rolePrivilege.privilegeid = privilegeid;
        return rolePrivilege;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof RolePrivilege)) return false;

        RolePrivilege that = (RolePrivilege) o;
        return privilegeid.equals(that.privilegeid) && roleid.equals(that.roleid);
    }

    @Override
    public int hashCode() {
        int result = roleid.hashCode();
        result = 31 * result + privilegeid.hashCode();
        return result;
    }
}
